#include "stdafx.h"
#include "QTableWidgetEx.h"
#include <QMap>
#include <QHBoxLayout>
#include <QTabWidget>

class QTableWidgetPrivate{
public:
	QMap<int,QWidget*>		m_mapToolBtn;
};


QTableWidgetEx::QTableWidgetEx(QWidget *parent)
	: QWidget(parent)
{
	m_pPrivate = new QTableWidgetPrivate;
	setMinimumSize(300,200);
}

QTableWidgetEx::~QTableWidgetEx()
{

}

void QTableWidgetEx::addTableToolButton( int nIndex,QWidget* pWidget)
{
	m_pPrivate->m_mapToolBtn[nIndex] = pWidget;
}

void QTableWidgetEx::createLayout()
{
	QWidget*	pTableToolWidget = new QWidget(this);
	pTableToolWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
	pTableToolWidget->setFixedHeight(50);
	QHBoxLayout*	hboxlayout = new QHBoxLayout(this);
	for (int i=0;i<m_pPrivate->m_mapToolBtn.size();i++)
	{
		hboxlayout->addWidget(m_pPrivate->m_mapToolBtn[i]);
	}

	QTabWidget*		pTableWidget = new QTabWidget(this);
	pTableWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
	pTableWidget->setFixedHeight(300);

	//QWidget*		pPageWidget = new QWidget(this);
}
